package com.tyh.management.service.impl;

import java.util.List;
import java.util.Map;

import com.tyh.management.mapper.CourseMapper;
import com.tyh.management.service.GcCourseService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.tyh.management.entity.Scores;
import com.tyh.management.mapper.GcCourseMapper;

@Service
public class GcCourseServiceImpl implements GcCourseService {

	@Autowired
	GcCourseMapper gcCourseMapper;

	@Autowired
	CourseMapper courseMapper;
	
	
	@Override
	public List<Scores>findScores(String coursename,String gcg,String gcc,int start, int pagesize ) {
		// TODO Auto-generated method stub
		return gcCourseMapper.findScores(coursename,gcg, gcc,start, pagesize );
	}


	@Override
	public List<Scores> findAllScores(String coursename, String gcg, String gcc) {
		// TODO Auto-generated method stub
		return gcCourseMapper.findAllScores(coursename,gcg, gcc);
	}


	@Override
	public List<Scores> compClaScores(String coursename, String gcg) {
		// TODO Auto-generated method stub
		return gcCourseMapper.compClaScores(coursename, gcg);
	}


	@Override
	public int updateScores(Map map) {
		// TODO Auto-generated method stub
		return gcCourseMapper.updateScores(map);
	}


	@Override
	public List<Scores> findPersonScore(String coursename, String num) {
		// TODO Auto-generated method stub
		return gcCourseMapper.findPersonScore(coursename, num);
	}

	@Override
	public int deleteScoreRecord(Map map) {
		String num = (String) map.get("num");
		String courseName = (String) map.get("courseName");

		String courseId = courseMapper.selectIdByName(courseName);
		return gcCourseMapper.delete( num, courseId);
	}


}
